package at.mri.dogwatch.client.pages.newestfeed;

import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.annotations.NameToken;
import at.mri.dogwatch.client.place.NameTokens;
import com.gwtplatform.mvp.client.proxy.ProxyPlace;
import com.google.inject.Inject;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
import com.gwtplatform.mvp.client.proxy.RevealContentEvent;
import at.mri.dogwatch.client.pages.layout.MainPagePresenter;

public class NewVideosFeedPresenter
		extends
		Presenter<NewVideosFeedPresenter.MyView, NewVideosFeedPresenter.MyProxy> {

	public interface MyView extends View {

		public abstract void addVideoSelectionChangeHandler(Handler handler);

		void refreshVideoFeed();
	}

	@ProxyCodeSplit
	@NameToken(NameTokens.feed)
	public interface MyProxy extends ProxyPlace<NewVideosFeedPresenter> {
	}

	@Inject
	public NewVideosFeedPresenter(final EventBus eventBus, final MyView view,
			final MyProxy proxy) {
		super(eventBus, view, proxy);
	}

	@Override
	protected void revealInParent() {
		RevealContentEvent
				.fire(this, MainPagePresenter.SLOT_SetCenterContent, this);
	}

	@Override
	protected void onBind() {
		super.onBind();
		getView().refreshVideoFeed();
	}
	
	@Override
	protected void onReveal() { 
		super.onReveal();
		getView().refreshVideoFeed();
	}
}
